package yxy.game.pm2.bean.pubsub;

import yxy.apple.util.PubSub.ISubscription;
import yxy.apple.util.PubSub.Publisher;
import yxy.game.pm2.bean.PlayerBean;

/** 角色等级变化发布 */
public class PlayerLevelPublisher extends Publisher {
	static private PlayerLevelPublisher instance;

	public static PlayerLevelPublisher getInstance() {
		if (instance == null) {
			instance = new PlayerLevelPublisher();
		}
		return instance;
	}

	private PlayerLevelPublisher() {

	}

	public void publish(PlayerBean playerBean, int originalLevel) {
		this.publish(new PlayerLevelSubscription(playerBean, originalLevel));
	}

	public static class PlayerLevelSubscription implements ISubscription {
		private PlayerBean playerBean;
		private int originalLevel;

		public PlayerLevelSubscription(PlayerBean playerBean, int originalLevel) {
			this.playerBean = playerBean;
			this.originalLevel = originalLevel;
		}

		public PlayerBean getPlayerBean() {
			return playerBean;
		}

		public int getOriginalLevel() {
			return originalLevel;
		}
	}
}
